﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 订单管理系统窗体应用
{
    public partial class CreateForm : Form
    {
        MainForm mainForm;
        public CreateForm(MainForm mainForm)
        {
            InitializeComponent();
            this.mainForm = mainForm;
        }

        private void CreateButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(IDInput.Text))
            {
                MessageBox.Show("ID不能为空！");
                return;
            }
            if (string.IsNullOrEmpty(CustomerInput.Text))
            {
                MessageBox.Show("Customer不能为空！");
                return;
            }
            if (string.IsNullOrEmpty(DateInput.Text))
            {
                MessageBox.Show("Date不能为空！");
                return;
            }
            int id = Convert.ToInt32(IDInput.Text);
            string customer = CustomerInput.Text;
            string date = DateInput.Text;
            
            Order order = new Order(id, customer, date);
            mainForm.create(order);

            MessageBox.Show("订单创建成功！");
            this.Close();


        }
    }
}
